package code.assets
{
	import code.interfaces.ISubMenu;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.ui.Mouse;
	import flash.ui.MouseCursor;
	
	import mx.controls.Text;
	
	public class InfoPanel extends mx.controls.Text implements ISubMenu
	{
		private var _id:String;
		
		public function InfoPanel()
		{
			addEventListener(MouseEvent.ROLL_OVER, onRollover);
			addEventListener(MouseEvent.ROLL_OUT, onRollout);
			addEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
			
			this.styleName = "info";
		}
		
		public function set linkID(nm:String):void
		{
			_id = nm;
		}
		
		public function get linkID():String
		{
			return _id;
		}
		
		protected function onRollover(evt:MouseEvent):void
		{
			Mouse.cursor = MouseCursor.BUTTON;
		}
		
		protected function onRollout(evt:MouseEvent):void
		{
			Mouse.cursor = MouseCursor.ARROW;
		}
		
		protected function onRemoved(evt:Event):void
		{
			removeEventListener(MouseEvent.ROLL_OVER, onRollover);
			removeEventListener(MouseEvent.ROLL_OUT, onRollout);
			removeEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
		}
		
		protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			this.graphics.beginFill(0xf1f1f1);
			this.drawRoundRect(0, 0, unscaledWidth, unscaledHeight, 7);
			this.graphics.endFill();
		}
	}
}